1136: Incorrect number of arguments. Expected 0 AS3 Flash CS5.5 [on hold]

Posted by Erick on Game Development See other posts from Game Development or by Erick
Published on 2014-08-23T17:06:32Z Indexed on 2014/08/23 22:36 UTC
Read the original article Hit count: 335

Filed under:
|

how do I solve this error? I've been trying to get the answer online but have not been successful. I'm trying to learn As3 for flash so I decided to try making a preloader for a game.

Preloader.as

package com.game.moran
{
import flash.display.LoaderInfo;
import flash.display.MovieClip;
import flash.events.*;

public class ThePreloader extends MovieClip
{
    private var fullWidth:Number;
    public var ldrInfo:LoaderInfo;

    public function ThePreloader (fullWidth:Number = 0, ldrInfo:LoaderInfo = null)
    {
        this.fullWidth = fullWidth;
        this.ldrInfo = ldrInfo;

        addEventListener(Event.ENTER_FRAME, checkLoad);
    }

    private function checkLoad (e:Event) : void
    {
        if (ldrInfo.bytesLoaded == ldrInfo.bytesTotal && ldrInfo.bytesTotal !=0)
        {
            dispatchEvent (new Event ("loadComplete"));
            phaseOut();
        }
        updateLoader (ldfInfo.bytesLoaded / ldrInfo.bytesTotal);
    }
    private function updateLoader(num:Number) : void
    {
        mcPreloaderBar.Width = num * fullWidth;
    }
    private function phaseOut() : void
    {
        removeEventListener (Event.ENTER_FRAME, checkLoad);
        phaseComplete();
    }
    private function phaseComplete() : void
    {
        dispatchEvent (new Event ("preloaderFinished"));
    }
}

}

Engine.as

package com.game.moran
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;

public class Engine extends MovieClip
{
    private var preloader:ThePreloader;

    public function Engine()
    {
        preloader = new ThePreloader(732, this.loaderInfo);
        stage.addChild(preloader);
        preloader.addEventListener("loadComplete", loadAssets);
        preloader.addEventListener("preloaderFinished", showSponsors);
    }
    private function loadAssets (e:Event) : void
    {
        this.play();
    }
    private function showSponsors(e:Event) : void
    {
        stage.removeChild(preloader);
        trace("show sponsors")
    }
}

}

The line being flagged as an error is line 13 in Engine.as.

© Game Development or respective owner

Related posts about flash

Related posts about actionscript-3